import { useEffect } from 'react';
import { connect } from 'dva';
import { Table, Tag, Space } from 'antd';


const data = [];


function EmployeeList({ list, dispatch }) {

  const columns = [
    {
      title: 'Name',
      dataIndex: 'firstName',
      key: 'firstName',
      render: text => <a>{text}</a>,
    },
    {
      title: 'Age',
      dataIndex: 'age',
      key: 'age',
    },
    {
      title: 'Address',
      dataIndex: 'address',
      key: 'address',
    },
    {
      title: 'Tags',
      key: 'tags',
      dataIndex: 'tags',


    },
    {
      title: 'Action',
      key: 'action',
      render: (text, record) => (

        <Space size="middle">
             <a onClick={() =>
            dispatch({
              type: 'list/updateLb',
              payload: {
                key: record.key,
              },
            })
          } >编辑</a>
          <a onClick={() =>
            dispatch({
              type: 'list/deleteLb',
              payload: {
                key: record.key,
              },
            })
          } >删除</a>
        </Space>
      ),
    },
  ];
  useEffect(() => {
    dispatch({
      type: 'list/getAll',
    });
  }, []);

  return (
    <div>
      <Table columns={columns} dataSource={list}></Table>
    </div>
  );
}

export default connect(({ list }) => ({ list }))(EmployeeList);
